package Text;

import java.util.Random;

public class Demo5 {
    public static void main(String[] args) {
        Random random = new Random();//构建随机数
        int x = random.nextInt(99999 - 10000 + 1) + 10000;//获取随机数
        System.out.println("该随机数为：" + x);

        //求随机数的每个位上的值
        int wan = x / 10000;
        int qian = x % 10000 / 1000;
        int bai = x % 1000 / 100;
        int shi = x % 100 / 10;
        int ge = x % 10;

        //定义新数字
        int newnum = ge*10000+shi*1000+bai*100+qian*10+wan;
        System.out.println("新的数为："+newnum);
    }
}
